using UnityEngine;
using System.Collections;

public class WheelRotation : MonoBehaviour {
	
	#region Variables
	//Must be static to be sent to player and cabin
	private static Vector3 rotation;
	public static Vector3 Rotation
		{
			get {return rotation;}
		}
	
	
	private static int counterSecond;
	public static int CouterSecond{
		get{ return counterSecond;}
	}
	
	private static int counterFrame;
	public static int CounterFrame{
		get { return counterFrame;}
	}
	#endregion

		
	// Use this for initialization
	void Start () {
		rotation.z = 0.1f; // starts the wheels rotation
		counterSecond=0;
		counterFrame=0;
	}
	
	// Update is called once per frame
	void Update () {
		
		counterFrame++;
		
		if(counterFrame==60){
			counterSecond++;
			rotation.z+=0.005f;
			counterFrame=0;
		}
		
		if(counterSecond==90){
			rotation.z=0;
		}
		
		transform.Rotate(rotation);//Rotates the wheel and by assosiation cabins along Z axis
		
	
	}
	
		
}
